import { createRouter, createWebHistory } from 'vue-router'
import UserLogin from '../views/UserLogin.vue'
import UserProfile from '../views/UserProfile.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import('../views/Home.vue')
  },
  {
    path: '/components',
    name: 'components',
    component: () => import('../views/Components.vue')
  },
  {
    path: '/component/:id',
    name: 'componentDetail',
    component: () => import('../views/ComponentDetail.vue'),
    props: true
  },
  {
    path: '/docs',
    name: 'docs',
    component: () => import('../views/Docs.vue')
  },
  {
    path: '/login',
    name: 'UserLogin',
    component: UserLogin
  },
  {
    path: '/profile',
    name: 'UserProfile',
    component: UserProfile
  },
  {
    path: '/components/manage',
    name: 'ComponentManage',
    component: () => import('../views/ComponentManage.vue')
  },
  // 404页面
  {
    path: '/:pathMatch(.*)*',
    name: 'not-found',
    component: () => import('../views/NotFound.vue')
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
